package com.qf.springboot2202.config;

import com.qf.springboot2202.entity.User;
import com.qf.springboot2202.service.HelloService;
import com.qf.springboot2202.service.impl.MyHelloServiceImpl;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;

@Configuration
public class MyConfig {
    @Bean
    public HelloService myhelloService(){
        final HelloService myHelloService = new MyHelloServiceImpl();
        return myHelloService;
    }
    @Bean
    @Scope("prototype")  // 默认是单例模式，加上@Scope("prototype")  bean变成多例模式
    public User user01(){
        return  new User(100,"zhangsan");
    }

    @Bean
    public User user02(){
        return  new User(200,"lisi");
    }
}
